package nl.nickthissen.remindme.data;

import com.activeandroid.Model;
import com.activeandroid.annotation.Column;
import com.activeandroid.annotation.Table;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by nthissen on 10/06/13.
 */
@Table(name="ReminderItems")
public class ReminderItem extends Model implements Serializable
{
    public ReminderItem()
    {
        super();
        this.createdDate = new Date();
        this.title = "New item";
        this.description = "";

        long time = new Date().getTime();
        time += 60*1000;
        this.reminderDate = new Date(time);

        this.category = CategoryManager.getDefaultCategory();
    }

    @Column(name="Title")
    public String title;

    @Column(name="Description")
    public String description;

    @Column(name="CreatedDate")
    public Date createdDate;

    @Column(name="ReminderDate")
    public Date reminderDate;

    @Column(name="Category")
    public Category category;

    @Override
    public boolean equals(Object obj)
    {
        if (obj == null) return false;
        if (obj == this) return true;
        if (!(obj instanceof ReminderItem)) return false;

        ReminderItem other = (ReminderItem)obj;
        return other.getId().equals(getId());
    }
}
